import org.testng.annotations.Test;
import utils.utils;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class stu {
    @Test
    public void textDML01(){
        PreparedStatement preparedStatement=null;
        Connection connection=null;
        ResultSet resultSet=null;
        String url="INSERT INTO db_2 VALUES (null,?)";
        try {
            connection = utils.getconnection();
            preparedStatement=connection.prepareStatement(url);
            for (int i = 0; i < 5000; i++) {
                preparedStatement.setString(1, "jack" + i);
                preparedStatement.addBatch();
                if ((i+1)%1000==0){
                    preparedStatement.executeBatch();
                    preparedStatement.clearBatch();
                }
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            utils.close(null,preparedStatement,connection);
        }
    }



}
